<template>
 <div>

     用户名：<input type="text" v-model="username">
     密码：<input type="text" v-model="password">

     <Button @click="login">登陆</Button>
     

 </div>
</template>

<script>
export default {
 data() {
  return {
      username:'',
      password:'',
  }
 },
 components: {

 },
 methods: {
  	login(){

  		//发送请求
      this.axios.get('http://localhost:8000/login/',{params:{username:this.username,password:this.password}}).then((result) =>{
            if(result.data.code==200){
                localStorage.setItem('uid',result.data.uid)
                this.$router.push({'path':'/order'});
            }
            else{
                this.$Message('登陆失败')
            }
      });

  	},
 },
}
</script>
